package sorter;
import java.rmi.RemoteException;
import java.rmi.server.*;

public class InsertionSort extends UnicastRemoteObject implements ISorter
{
	protected InsertionSort() throws RemoteException {
		super();
	}

	@Override
	public Comparable[] sort(Comparable[] c)
	{
		Comparable[] d = c;
		for (int i = 1; i < d.length; i++) 
		{
		    int j = i;
		    Comparable e = d[i];
		    while ((j > 0) && (d[j-1].compareTo(e) > 0)) 
		    {
		        d[j] = d[j-1];
		        j--;
		    }
		    d[j] = e;
	    }
		return d;
	}

}